<?php
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use yii\widgets\LinkPager;
use frontend\controllers\ListController;
use common\models\articles\Articles;
use common\models\member\Member;
use common\models\category\Category;
use common\models\Fenhuigrade\Fenhuigrade;
    $fenhui = Fenhuigrade::find()->where(['status' => Fenhuigrade::STATUS_ACTIVE])->limit(6)->all();
    $tongzhi = Articles::find()->where(['category_id'=>18, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $zhengce = Articles::find()->where(['category_id'=>25, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $hangye = Articles::find()->where(['category_id'=>28, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $pinpai = Articles::find()->where(['category_id'=>23, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $xinwen = Articles::find()->where(['category_id'=>14, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
        // 会员风采
    $memberstyle = Member::find()->where(['status' => Member::STATUS_SUCCESS])->asArray()->limit(9)->all();
    $membersytletype = Category::find()->where(['id' =>20])->asArray()->one()['ctype'];

    $controllerID = Yii::$app->controller->id;
    $actionID = Yii::$app->controller->action->id;
?>
    <!--content-->
    <div class="content">
        <div class="w1113 bgd-ff mt10 mb10" style="margin-bottom:10px; margin-top:10px;">
            <span class="abwz">
                YOUR LOCATION：<a href="<?= yii\helpers\Url::to(['/']);?>">HOME</a> >
                <a href="<?= yii\helpers\Url::to([$parentinfo['type'], 'id' => $parentinfo['id']]); ?>"><?= $parentinfo['name']; ?></a> >
                <a> <?= $cat['name']; ?></a>
            </span>
        </div>
        <div class="w1113 bgd-ff">
            <div class="clearFloat pl20 pr20 pt15 pb50">
                <div class="ableft floatLeft">
                    <div class="ablewidt">
                        <h3 class="anh3"><?= $parentinfo['name'];?></h3>
                        <div class="abnav">
                            <ul  class="acb">
                            <?php if(!empty($childcat)){ ?>
                                <?php foreach($childcat as $t){ ?>
                                    <li>
                                        <?php if(!empty($t['url'])){ ?>
                                            <a <?php if($cat['id'] == $t['id']){echo ' class="abnnac"';} ?> href="<?= $t['url']; ?>"><?=$t['name']; ?></a>
                                        <?php }else{
                                            ?>
                                            <a <?php if($cat['id'] == $t['id']){echo ' class="abnnac"';} ?> href="<?= yii\helpers\Url::to([$t['type'], 'id' => $t['id']]); ?>"><?=$t['name']; ?></a>
                                        <?php  } ?>
                                        <?php if(!empty($t['zlm'])){ ?>
                                            <ul class="submenu">
                                                <?php foreach ($t['zlm'] as $pz){ ?>
                                                    <li><a href="<?= yii\helpers\Url::to([$pz['type'],'id' => $pz['id']]); ?>"><?=$pz['name']; ?></a></li>
                                                <?php } ?>
                                            </ul>
                                        <?php } ?>
                                    </li>
                                <?php } ?>
                             <?php }else{ ?>
                                <li class="active"> <a href="<?= yii\helpers\Url::to([$cat['type'], 'id' => $cat['id']]); ?>"><?=$cat['name']; ?></a>
                            <?php } ?>
                            </ul>
                        </div>
                    </div>
                    <script type="text/javascript">
                        jQuery(document).ready(function () {
                            jQuery(".jquery-accordion-menu").jqueryAccordionMenu();

                        });

                        $(function(){
                            //顶部导航切换
                            $(".acb li").click(function(){
                                $(".acb li.active").removeClass("active")
                                $(this).addClass("active");
                            })
                        })
                    </script>
                </div>
                <div class="abright floatRight">
                    <div class="abrwidth">
                        <div class="clearFloat abrwidt">
                            <h3 class="xhjsh3">
                                <font class="ttt"><?=$article['title'];?></font>
                                <span class="xhjstime">Time:<?= date('Y/m/d H:i:s',$article['updated_at']);?> Hit:<?= $article['hit']; ?>
                            </h3>
                            <div class="clearFloat xhp">
                                <p>
                                    <?= $article['content'];?>
                                </p>
                            </div>
                        </div>
                        <div class="clearFloat xhxgxw">
                            <h3 class="xgxwtit">Related news</h3>
                            <div class="xgxwcont">
                                <ul>
                                    <?php
                                    $num = 0;
                                     foreach($articles as $k=>$t){ 
                                        if($num<5){
                                            $num++;
                                    ?>
                                    <li>
                                        <a href="<?= yii\helpers\Url::to([$cat['ctype'], 'id' => $t['id']]); ?>"><?=$t['title'];?></a>
                                    </li>
                                    <?php 
                                        }
                                    }
                                     ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--content end-->